import request from '@/utils/request';
// 店铺装修列表查询
export const querypageManagementList = async (
  params: {
    type: string;
    id?: string;
    status?: string; // 0：草稿 2：已发布 3：使用中 4：定时发布
    name?: string;
    channelCode?: string;
  } & TPageParam,
) =>
  request<TCommonResult>('/pageManagement/list', {
    method: 'GET',
    params,
  });
// 店铺装修列表修改名字
export const setUpdateName = async (data: any) =>
  request<TCommonResult>('/pageManagement/updateName', {
    method: 'POST',
    data,
  });
// 删除列表数据
export const deleteManagement = async (
  params: {
    id: number;
  } & TPageParam,
) =>
  request<TCommonResult>('/pageManagement/delete', {
    method: 'POST',
    params,
  });
// 复制列表数据
export const copyManagement = async (
  params: {
    id: number;
  } & TPageParam,
) =>
  request<TCommonResult>('/pageManagement/copy', {
    method: 'POST',
    params,
  });
// 模板列表数据
export const queryTemplateList = async (
  params: {
    type: number;
  } & TPageParam,
) =>
  request<TCommonResult>('/pageManagement/template/list', {
    method: 'GET',
    params,
  });
// 保存或者修改
export const saveOrUpdate = async (data: any) =>
  request<TCommonResult>('/pageManagement/saveOrUpdate', {
    method: 'POST',
    data,
  });
// 修改状态
export const updateStatus = async (data: any) =>
  request<TCommonResult>('/pageManagement/updateStatus', {
    method: 'POST',
    data,
  });
// 商品下拉框数据
export const querypullDownList = async (
  params: {
    type: number;
    productNo?: string; // 商品编号
    productName?: string; // 商品名字
    productNoOrName?: string; // 商品编号/商品名字
  } & TPageParam,
) =>
  request<TCommonResult>('/mall/product/pullDown', {
    method: 'GET',
    params,
  });
// 活动类型列表
export const queryactivityList = async (params: {} & TPageParam) =>
  request<TCommonResult>('/activity/type/list', {
    method: 'GET',
    params,
  });
// 新人活动列表
export const queryrecruitList = async (
  params: {
    activityName?: string; // 活动名称
    recruitState?: string; // 渠道
    startTime?: string;
    endTime?: string;
    status?: number; // 状态 0-已关闭，1-已开启，2-待开启，3-已过期
    id?: string;
    idOrName?: string; // 模糊搜索
  } & TPageParam,
) =>
  request<TCommonResult>('/recruit/list', {
    method: 'GET',
    params,
  });
// 发券活动列表
export const querysendcouponList = async (
  params: {
    activityType?: string; // 活动类型
    name?: string; // 活动名称
    activityId?: string; // 活动id
    startTime?: string;
    endTime?: string;
    status?: number; // 状态 0:草稿,1:待发布,2:测试发布,3:正式发布,4:停用,5已过期
    page: number;
    pageSize: number;
    idOrName?: string; // 模糊搜索
  } & TPageParam,
) =>
  request<TCommonResult>('/sendcoupon/list', {
    method: 'GET',
    params,
  });
// 抽奖活动列表
export const querylotterydrawList = async (
  params: {
    activityType?: string; // 活动类型
    name?: string; // 活动名称
    activityId?: string; // 活动id
    startTime?: string;
    endTime?: string;
    status?: number; // 状态 0:草稿,1:待发布,2:测试发布,3:正式发布,4:停用,5已过期
    page: number;
    pageSize: number;
    idOrName?: string; // 模糊搜索
  } & TPageParam,
) =>
  request<TCommonResult>('/lotterydraw/list', {
    method: 'GET',
    params,
  });
// 老拉新活动列表
export const queryinviteList = async (
  params: {
    activityType?: string; // 活动类型
    name?: string; // 活动名称
    activityId?: string; // 活动id
    startTime?: string;
    endTime?: string;
    status?: number; // 状态 0:草稿,1:待发布,2:测试发布,3:正式发布,4:停用,5已过期
    page: number;
    pageSize: number;
    idOrName?: string; // 模糊搜索
  } & TPageParam,
) =>
  request<TCommonResult>('/invite/list', {
    method: 'GET',
    params,
  });
// 预览
export const previewData = async (data: any) =>
  request<TCommonResult>('/pageManagement/preview', {
    method: 'POST',
    data,
  });
